package com.zxlspace.collection;


import java.util.HashSet;
import java.util.Set;

public class SetTest {

    public static void main(String[] args) {
        //set 无序，不重复，底层是hashmap, set添加的值作为hashmap的key，不能重复
        Set set = new HashSet();

        set.add("aaa");
        set.add("bbb");
        set.add(new String("aaa"));
        System.out.println(set.size());


        Set set1 = new HashSet();
       /* set1.add("123");
        set1.add("456");*/
        set1.add("aaa");
        set1.add("bbb");
        boolean flag = set.retainAll(set1);
        System.out.println(flag);
    }
}
